package cn.how2j.chain;

import java.util.ArrayList;
import java.util.List;

public class ChainDemo {
    public static void main(String[] args) {
        List<Filter> filters = new ArrayList<>();
        Servlet servlet = new Servlet();

        URLFilter urlFilter = new URLFilter();
        PfmFilter pfmFilter = new PfmFilter();

        filters.add(urlFilter);
        filters.add(pfmFilter);

        FilterChain filterChain = new FilterChain(filters, servlet);

        Request request = new Request();
        request.setUrl("/a.jsp");
        request.setRemoteIp("127.0.0.1");

        Response response = new Response();
        filterChain.doFilter(request, response);

    }
}
